package com.qczl.pme.util;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.qczl.pme.entity.PMESewise;
import com.qczl.util.ConfigUtil;
import com.qczl.util.HttpClientUtil;

public class SewiseUtil {
	
	public static JSONObject recording(PMESewise sewise,String streamid,String callback) throws Exception{
		String port = "";
		if(sewise.getProt2()!=null&&!sewise.getProt2().equals("")){
			port+=":"+sewise.getProt2();
		}
		final String url = "http://"+sewise.getIp()+port+"/record";
//		System.out.println(url+"?do=start&streamid="+streamid+"&callback="+ConfigUtil.getByKey("config", callback));
		Map<String,String> map = new HashMap<String,String>();
		map.put("do", "start");
		map.put("streamid", streamid);
		map.put("callback", ConfigUtil.getByKey("config", callback));
		String result = HttpClientUtil.doPost(url, map);
		return JSONObject.parseObject(result);
	}
	
}	
